package com.ihr360.oneclick.dao;

import com.ihr360.oneclick.dto.OneClickTermDto;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.List;

/**
 * @author tom
 * @date 17-12-18
 */
public interface OneClickTermDao extends JpaRepository<OneClickTermDto, String>, JpaSpecificationExecutor<OneClickTermDto> {

    List<OneClickTermDto> findByCompanyIdAndEnable(String companyId, boolean enable);

    List<OneClickTermDto> findByCompanyIdInAndEnableOrderByCreatedAtAsc(List<String> companyIdList, boolean enable);

    long countByCompanyIdAndTermName(String companyId, String termName);

    long countByCompanyIdAndTermNameAndIdNot(String companyId, String termName, String id);

}
